/* test order by */

CREATE TABLE NATION   ( N_NATIONKEY     i4,
                        N_NAME          c25,
                        N_REGIONKEY     i4,
                        N_COMMENT       c152 );

LOAD NATION   ("../../data/contest/nation.data");

queryplans on;

select * from NATION where N_NATIONKEY = 1;
select N_NAME from NATION order by N_NAME;
select N_NAME from NATION order by N_REGIONKEY;
select * from NATION where N_NATIONKEY > 1 order by N_NATIONKEY desc;
select N_NAME from NATION where N_NATIONKEY > 1 order by N_NATIONKEY desc;
select * from NATION order by N_NATIONKEY asc;
select * from NATION order by N_NAME;

/*
select * from NATION, NATION2 where 
NATION.N_NAME=NATION2.N_NAME and
NATION.N_REGIONKEY=NATION2.N_REGIONKEY;
*/

CREATE INDEX NATION(N_NAME);
select N_NATIONKEY, N_NAME from NATION where N_NAME > "F" order by N_NAME;

/* error - only one ordering key supported */
select * from NATION order by N_NATIONKEY, N_NAME;

exit;
